
A.ui =
{
    init: function()
    {
        // Facebook connection button
        $('#FBConnect').click( A.facebook.login );


        // Event Logout
        A.event.subscribe('logout', function(){ $('#FBConnect').show(); });

        // Event Login
        A.event.subscribe('login', function()
        {
            $('#FBConnect').hide();
            $('#user').html('<img src="' + A.user.pic + '"> ' + A.user.name);
        });

        // Event Get Feeds
        A.event.subscribe('get_feeds', function(data)
        {
            var html = [];
            for (var i in data)
            {
                html.push('<li>' + data[i].title + '</li>');
            }
            
            $('#feeds').html( html.join('') );
        });
    }
};
